//
//  UIViewController+JZdealloc.m
//  tf02
//
//  Created by Jim on 2017/3/14.
//  Copyright © 2017年 Jim. All rights reserved.
//

#import "UIViewController+JZdealloc.h"
#import <objc/runtime.h>

typedef void (*_VIMP)(id, SEL, ...);

@implementation UIViewController (JZdealloc)

+ (void)load
{
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        Method dealloc = class_getInstanceMethod(self, @selector(dealloc));
        _VIMP dealloc_VIMP = (_VIMP)class_getMethodImplementation(self, @selector(dealloc));
        method_setImplementation(dealloc, imp_implementationWithBlock(^(id target, SEL action) {
            NSLog(@"\n控制器%@已释放\n", target);
            dealloc_VIMP(target, action);            
        }));
    });
}

@end
